import type { ColProps, FormItemProps } from 'ant-design-vue'
import type { RuleObject } from 'ant-design-vue/lib/form'

/**
 * 表单规则模型
 */
export interface BwFormRuleModel extends FormItemProps {
  field: string
  title: string
  type?: any
  hide?: boolean
  props?: Record<string, any>
  on?: Record<string, Function>
  rules?: RuleObject | RuleObject[] | undefined
  col?: ColProps
  labelCol?: ColProps
  wrapperCol?: ColProps
  medelField?: string
}

/**
 * 表单栅格模型
 */
export interface BwFormGridModel {
  labelCol: ColProps
  wrapperCol: ColProps
}

/**
 * 表单外放属性模型
 */
export interface BwFormPropsModel {
  col?: ColProps
  wrap?: BwFormGridModel
  hideRequiredMark?: boolean
  formData?: Record<string, any>
  formRules?: Array<BwFormRuleModel>
  layout?: 'horizontal' | 'vertical' | 'inline'
}

/** 弹窗表单外放属性模型 */
export interface BwFormModalPropsModel {
  visible?: boolean

  title?: string

  okText?: string

  cancelText?: string

  okButtonProps?: Record<string, any>

  width?: number

  minHeight?: number

  maskClosable?: boolean

  hideRequiredMark?: boolean

  col?: ColProps

  wrap?: BwFormGridModel

  formData?: Record<string, any>

  formRules?: Array<BwFormRuleModel>
}
